package com.example.shopping_web_back.mapper;

import com.example.shopping_web_back.pojo.GoodsDetails;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface GoodsDetailsMapper {

    @Insert("insert into shoppingweb.goods_details (goods_id, goods_detail) values (#{id}, #{imageUrl})")
    void addGoodsDetails(Integer id, String imageUrl);

    @Delete("delete from shoppingweb.goods_details where goods_detail=#{goodsDetailsImage}")
    void deleteGoodsDetails(String goodsDetailsImage);

    @Update("update shoppingweb.goods_details set goods_detail=#{newGoodsDetails1} where goods_id=#{id} and goods_detail=#{oldGoodsDetails1}")
    void changeGoodsDetails(String oldGoodsDetails1, Integer id, String newGoodsDetails1);

    @Select("select goods_detail from shoppingweb.goods_details where goods_id=#{id}")
    List<GoodsDetails> getGoodsDetails(Integer id);
}
